package util

type Comparer[T any] func(a, b T) bool

func Contains[T any](c Comparer[T], list []T, e T) bool {
	for i := range list {
		if c(list[i], e) {
			return true
		}
	}
	return false
}

func Without[T any](c Comparer[T], list []T, another ...T) []T {
	vs := make([]T, 0)
	for i := range list {
		if !Contains(c, another, list[i]) {
			vs = append(vs, list[i])
		}
	}
	return vs
}
